<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta name="baidu-site-verification" content="bk1wz1wzS4">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">



<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css">


  <meta name="keywords" content="总结,">








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0">






<meta name="description" content="探索ionic轮播ionic轮播自带标签在ionic做的第一个轮播12345678910111213141516171819202122232425262728293031323334353637383940&amp;lt;ion-view view-title=&quot;欢迎&quot;&amp;gt;        &amp;lt;ion-slide-box on-slide-changed=&quot;slideChanged(index)&quot;">
<meta name="keywords" content="总结">
<meta property="og:type" content="article">
<meta property="og:title" content="2016第52周总结">
<meta property="og:url" content="https://youandme66.github.io/2016/12/26/second/index.html">
<meta property="og:site_name" content="腊月的季节">
<meta property="og:description" content="探索ionic轮播ionic轮播自带标签在ionic做的第一个轮播12345678910111213141516171819202122232425262728293031323334353637383940&amp;lt;ion-view view-title=&quot;欢迎&quot;&amp;gt;        &amp;lt;ion-slide-box on-slide-changed=&quot;slideChanged(index)&quot;">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2016-12-26T06:33:06.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="2016第52周总结">
<meta name="twitter:description" content="探索ionic轮播ionic轮播自带标签在ionic做的第一个轮播12345678910111213141516171819202122232425262728293031323334353637383940&amp;lt;ion-view view-title=&quot;欢迎&quot;&amp;gt;        &amp;lt;ion-slide-box on-slide-changed=&quot;slideChanged(index)&quot;">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'youandme'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://youandme66.github.io/2016/12/26/second/">





  <title> 2016第52周总结 | 腊月的季节 </title>
  <script>
  (function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
  })();
</script>
</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">腊月的季节</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>


    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope="" itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="https://youandme66.github.io/2016/12/26/second/">

  <span style="display:none" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
    <meta itemprop="name" content="腊月的季节">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/uploads/avatar.jpg">
  </span>

  <span style="display:none" itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="腊月的季节">
    <span style="display:none" itemprop="logo" itemscope="" itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="腊月的季节" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                2016第52周总结
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2016-12-26T00:00:00+08:00">
                2016-12-26
              </time>
            

            

            
          </span>

          
            <span class="post-category">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="/categories/EffectWork/" itemprop="url" rel="index">
                    <span itemprop="name">EffectWork</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
            <!--noindex-->
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                  <a href="/2016/12/26/second/#comments" itemprop="discussionUrl">
                    <span class="post-comments-count hc-comment-count" data-xid="2016/12/26/second/" itemprop="commentsCount"></span>
                  </a>
                </span>
              </span>
              <!--/noindex-->
            
          

          

          
          
             <span id="/2016/12/26/second/" class="leancloud_visitors" data-flag-title="2016第52周总结">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               <span class="post-meta-item-text">阅读次数 </span>
               <span class="leancloud-visitors-count"></span>
              </span>
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="探索ionic轮播"><a href="#探索ionic轮播" class="headerlink" title="探索ionic轮播"></a>探索ionic轮播</h3><p>ionic轮播自带标签<br>在ionic做的第一个轮播<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">ion-view</span> <span class="attr">view-title</span>=<span class="string">"欢迎"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-slide-box</span> <span class="attr">on-slide-changed</span>=<span class="string">"slideChanged(index)"</span>&gt;</span></span><br><span class="line">          <span class="tag">&lt;<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">h3</span>&gt;</span>欢迎使用EffectWork<span class="tag">&lt;/<span class="name">h3</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"logo"</span>&gt;</span></span><br><span class="line">              <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">"img/effectwork.jpeg"</span> <span class="attr">alt</span>=<span class="string">"加载失败"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">p</span>&gt;</span></span><br><span class="line">              专门为时间打造</span><br><span class="line">            <span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">p</span>&gt;</span></span><br><span class="line">              开始我们每天的任务</span><br><span class="line">            <span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br><span class="line">          <span class="tag">&lt;/<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">          <span class="tag">&lt;<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">h3</span>&gt;</span>我们一起出发<span class="tag">&lt;/<span class="name">h3</span>&gt;</span></span><br><span class="line">            </span><br><span class="line">            <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"list"</span>&gt;</span></span><br><span class="line">              <span class="tag">&lt;<span class="name">h5</span>&gt;</span>时间<span class="tag">&lt;/<span class="name">h5</span>&gt;</span></span><br><span class="line">              <span class="tag">&lt;<span class="name">ol</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">li</span>&gt;</span>生活要以快乐为基准爱情要以互惠为原则<span class="tag">&lt;/<span class="name">li</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">li</span>&gt;</span>爱情不是空中楼阁，它是需要强大的物质基础来做地基做保障的。<span class="tag">&lt;/<span class="name">li</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">li</span>&gt;</span>时间一直在这里，流逝的是我们自己。<span class="tag">&lt;/<span class="name">li</span>&gt;</span></span><br><span class="line">              <span class="tag">&lt;/<span class="name">ol</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">          <span class="tag">&lt;/<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">          <span class="tag">&lt;<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">h3</span>&gt;</span>来到我的时间<span class="tag">&lt;/<span class="name">h3</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">p</span>&gt;</span></span><br><span class="line">              不要浪费你的生命在你一定会后悔的地方上。</span><br><span class="line">            <span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"login"</span>&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button button-outline button-positive"</span> <span class="attr">ng-click</span>=<span class="string">"log()"</span>&gt;</span>登录<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">             &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span><br><span class="line">             <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button button-outline button-positive"</span> <span class="attr">ng-click</span>=<span class="string">"reg()"</span>&gt;</span>注册<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">            </span><br><span class="line">          <span class="tag">&lt;/<span class="name">ion-slide</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">ion-slide-box</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;/<span class="name">ion-view</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>利用了<ion-slide-box> <ion-slide>标签来制作ionic轮播。</ion-slide></ion-slide-box></p>
<h3 id="探索ionic视图设定"><a href="#探索ionic视图设定" class="headerlink" title="探索ionic视图设定"></a>探索ionic视图设定</h3><p>这个可以称前端的视图路由<br>我采用了$urlRouterProvider,$stateProvider两个服务进行视图路由及视图与控制器的绑定。<br>具体代码如下<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">angular.module(<span class="string">'EffectWork.routes'</span>,[])</span><br><span class="line">.config(<span class="function"><span class="keyword">function</span>(<span class="params">$urlRouterProvider,$stateProvider</span>)</span>&#123;</span><br><span class="line">	$stateProvider</span><br><span class="line">        <span class="comment">//欢迎界面</span></span><br><span class="line">        .state(<span class="string">'splash'</span>, &#123;   <span class="comment">//splash路由名称</span></span><br><span class="line">            url: <span class="string">'/splash'</span>, <span class="comment">//前端路由一般就是#/splash</span></span><br><span class="line">            cache: <span class="literal">false</span>,  <span class="comment">//是否缓存</span></span><br><span class="line">            templateUrl: <span class="string">'views/splash_screen/splash.html'</span>, <span class="comment">//视图</span></span><br><span class="line">            controller: <span class="string">'splashCtrl'</span> <span class="comment">//控制器</span></span><br><span class="line">        &#125;)</span><br><span class="line">        .state(<span class="string">'login'</span>,&#123;</span><br><span class="line">        	url:<span class="string">'/login'</span>,</span><br><span class="line">        	templateUrl:<span class="string">'views/login.html'</span>,</span><br><span class="line">        	controller:<span class="string">'loginCtrl'</span></span><br><span class="line">        &#125;)</span><br><span class="line">        .state(<span class="string">'register'</span>,&#123;</span><br><span class="line">        	url:<span class="string">'/register'</span>,</span><br><span class="line">        	templateUrl:<span class="string">'views/register.html'</span>,</span><br><span class="line">        	controller:<span class="string">'registerCtrl'</span></span><br><span class="line">        &#125;)</span><br><span class="line">        .state(<span class="string">'forget'</span>,&#123;</span><br><span class="line">        	url:<span class="string">'/forget'</span>,</span><br><span class="line">        	templateUrl:<span class="string">'views/forget.html'</span>,</span><br><span class="line">        	controller:<span class="string">'forgetCtrl'</span></span><br><span class="line">        &#125;)</span><br><span class="line">        .state(<span class="string">"tab"</span>, &#123;</span><br><span class="line">            url: <span class="string">"/tab"</span>,</span><br><span class="line">            abstract: <span class="literal">true</span>,</span><br><span class="line">            templateUrl: <span class="string">"views/tabs.html"</span>,</span><br><span class="line">            controller:<span class="string">"tabCtrl"</span></span><br><span class="line">        &#125;)</span><br><span class="line">        .state(<span class="string">'tab.home'</span>, &#123;</span><br><span class="line">            url: <span class="string">'/home'</span>,</span><br><span class="line">            views: &#123;</span><br><span class="line">                <span class="string">'tab-home'</span>: &#123;</span><br><span class="line">                    templateUrl: <span class="string">'views/tab-home.html'</span>,</span><br><span class="line">                    controller: <span class="string">"homeCtrl"</span></span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;)</span><br><span class="line">    $urlRouterProvider.otherwise(<span class="string">"/splash"</span>); <span class="comment">//默认前端路由/splash</span></span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure></p>
<h3 id="路由跳转"><a href="#路由跳转" class="headerlink" title="路由跳转"></a>路由跳转</h3><p>采用$state服务<br>利用$state服务的go()方法，参数为指定路由名称。<br>具体代码如下：<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">angular.module(<span class="string">'EffectWork.controllers'</span>)</span><br><span class="line">.controller(<span class="string">'splashCtrl'</span>,[<span class="string">'$scope'</span>,<span class="string">'$state'</span>,<span class="function"><span class="keyword">function</span>(<span class="params">$scope,$state</span>)</span>&#123;</span><br><span class="line">	$scope.log=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">		$state.go(<span class="string">'login'</span>);</span><br><span class="line">	&#125;;</span><br><span class="line">	$scope.reg=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">		$state.go(<span class="string">'register'</span>);</span><br><span class="line">	&#125;;</span><br><span class="line">&#125;])</span><br></pre></td></tr></table></figure></p>
<h3 id="关于键盘窗口挡住输入框"><a href="#关于键盘窗口挡住输入框" class="headerlink" title="关于键盘窗口挡住输入框"></a>关于键盘窗口挡住输入框</h3><p>我所有的输入表单都用<ion-content>包括，然后加上属性delegate-handle=””即可进行页面滑动，可以不挡住输入框，至于还有另一种方法，就是利用keyboard插件，进行键盘事件监控。我采用了第一种，目前还没出现问题。<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">ion-view</span> <span class="attr">view-title</span>=<span class="string">"找回密码"</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"bar bar-header bar-calm"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">h1</span> <span class="attr">class</span>=<span class="string">"title"</span>&gt;</span>找回密码<span class="tag">&lt;/<span class="name">h1</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">ion-content</span> <span class="attr">class</span>=<span class="string">"rj-stable-content"</span> <span class="attr">delegate-handle</span>=<span class="string">"findPwd"</span> <span class="attr">id</span>=<span class="string">"findPassword"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"list list-inset has-header"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">label</span> <span class="attr">class</span>=<span class="string">"item item-input"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">placeholder</span>=<span class="string">"手机号"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">label</span> <span class="attr">class</span>=<span class="string">"item item-input"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"password"</span> <span class="attr">placeholder</span>=<span class="string">"密码"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">label</span> <span class="attr">class</span>=<span class="string">"item item-input"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"password"</span> <span class="attr">placeholder</span>=<span class="string">"再次输入密码"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">label</span> <span class="attr">class</span>=<span class="string">"item item-input item-input-inset"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">placeholder</span>=<span class="string">"输入验证码"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button button-outline button-calm"</span> <span class="attr">style</span>=<span class="string">"height:10px;"</span>&gt;</span></span><br><span class="line">  获取验证码</span><br><span class="line">   <span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button button-block button-calm"</span> <span class="attr">ng-click</span>=<span class="string">"findPwd()"</span>&gt;</span></span><br><span class="line">  找回密码</span><br><span class="line"><span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button button-clear button-positive"</span> <span class="attr">style</span>=<span class="string">"text-decoration:underline;"</span> <span class="attr">ng-click</span>=<span class="string">"backLogin()"</span>&gt;</span></span><br><span class="line">  返回</span><br><span class="line"><span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-content</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-view</span>&gt;</span></span><br></pre></td></tr></table></figure></ion-content></p>
<h3 id="关于ionic上拉菜单样式问题"><a href="#关于ionic上拉菜单样式问题" class="headerlink" title="关于ionic上拉菜单样式问题"></a>关于ionic上拉菜单样式问题</h3><p>ionic上拉菜单样式会有一些问题，导致很不好看，具体做法是把我下面的代码加入style.css<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-backdrop</span> &#123;</span><br><span class="line">    <span class="attribute">-webkit-transition</span>: background-color <span class="number">150ms</span> ease-in-out;</span><br><span class="line">    <span class="attribute">transition</span>: background-color <span class="number">150ms</span> ease-in-out;</span><br><span class="line">    <span class="attribute">position</span>: fixed;</span><br><span class="line">    <span class="attribute">top</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">z-index</span>: <span class="number">11</span>;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">    <span class="attribute">height</span>: <span class="number">100%</span>;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(0, 0, 0, 0);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-backdrop</span><span class="selector-class">.active</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(0, 0, 0, 0.4);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-wrapper</span> &#123;</span><br><span class="line">    <span class="attribute">-webkit-transform</span>: <span class="built_in">translate3d</span>(0, 100%, 0);</span><br><span class="line">    <span class="attribute">transform</span>: <span class="built_in">translate3d</span>(0, 100%, 0);</span><br><span class="line">    <span class="attribute">-webkit-transition</span>: all <span class="built_in">cubic-bezier</span>(0.36, 0.66, 0.04, 1) <span class="number">500ms</span>;</span><br><span class="line">    <span class="attribute">transition</span>: all <span class="built_in">cubic-bezier</span>(0.36, 0.66, 0.04, 1) <span class="number">500ms</span>;</span><br><span class="line">    <span class="attribute">position</span>: absolute;</span><br><span class="line">    <span class="attribute">bottom</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">right</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">    <span class="attribute">max-width</span>: <span class="number">500px</span>;</span><br><span class="line">    <span class="attribute">margin</span>: auto;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-up</span> &#123;</span><br><span class="line">    <span class="attribute">-webkit-transform</span>: <span class="built_in">translate3d</span>(0, 0, 0);</span><br><span class="line">    <span class="attribute">transform</span>: <span class="built_in">translate3d</span>(0, 0, 0);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> &#123;</span><br><span class="line">    <span class="attribute">margin-left</span>: <span class="number">8px</span>;</span><br><span class="line">    <span class="attribute">margin-right</span>: <span class="number">8px</span>;</span><br><span class="line">    <span class="attribute">width</span>: auto;</span><br><span class="line">    <span class="attribute">z-index</span>: <span class="number">11</span>;</span><br><span class="line">    <span class="attribute">overflow</span>: hidden;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span> &#123;</span><br><span class="line">    <span class="attribute">display</span>: block;</span><br><span class="line">    <span class="attribute">padding</span>: <span class="number">1px</span>;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">    <span class="attribute">border-radius</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#d1d3d6</span>;</span><br><span class="line">    <span class="attribute">background-color</span>: transparent;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#007aff</span>;</span><br><span class="line">    <span class="attribute">font-size</span>: <span class="number">21px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#007aff</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span><span class="selector-class">.destructive</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#ff3b30</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span><span class="selector-class">.destructive</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#ff3b30</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span><span class="selector-class">.active</span>, <span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span><span class="selector-class">.activated</span> &#123;</span><br><span class="line">    <span class="attribute">box-shadow</span>: none;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#d1d3d6</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#007aff</span>;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#e4e5e7</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-has-icons</span> <span class="selector-class">.icon</span> &#123;</span><br><span class="line">    <span class="attribute">position</span>: absolute;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">16px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-title</span> &#123;</span><br><span class="line">    <span class="attribute">padding</span>: <span class="number">16px</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#8f8f8f</span>;</span><br><span class="line">    <span class="attribute">text-align</span>: center;</span><br><span class="line">    <span class="attribute">font-size</span>: <span class="number">13px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-group</span> &#123;</span><br><span class="line">    <span class="attribute">margin-bottom</span>: <span class="number">8px</span>;</span><br><span class="line">    <span class="attribute">border-radius</span>: <span class="number">4px</span>;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="number">#fff</span>;</span><br><span class="line">    <span class="attribute">overflow</span>: hidden;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-group</span> <span class="selector-class">.button</span> &#123;</span><br><span class="line">    <span class="attribute">border-width</span>: <span class="number">1px</span> <span class="number">0px</span> <span class="number">0px</span> <span class="number">0px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-group</span> <span class="selector-class">.button</span><span class="selector-pseudo">:first-child</span><span class="selector-pseudo">:last-child</span> &#123;</span><br><span class="line">    <span class="attribute">border-width</span>: <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-options</span> &#123;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#f1f2f3</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-cancel</span> <span class="selector-class">.button</span> &#123;</span><br><span class="line">    <span class="attribute">font-weight</span>: <span class="number">500</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-open</span> &#123;</span><br><span class="line">    <span class="attribute">pointer-events</span>: none;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-open</span><span class="selector-class">.modal-open</span> <span class="selector-class">.modal</span> &#123;</span><br><span class="line">    <span class="attribute">pointer-events</span>: none;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-open</span> <span class="selector-class">.action-sheet-backdrop</span> &#123;</span><br><span class="line">    <span class="attribute">pointer-events</span>: auto;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.action-sheet-title</span>, <span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet</span> <span class="selector-class">.button</span> &#123;</span><br><span class="line">    <span class="attribute">text-align</span>: center;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.platform-android</span> <span class="selector-class">.action-sheet-cancel</span> &#123;</span><br><span class="line">    <span class="attribute">display</span>: block;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>即可解决</p>
<h3 id="关于标签"><a href="#关于标签" class="headerlink" title="关于标签"></a>关于标签</h3><p>利用ionic <ion-tabs><ion-tab><ion-nav-view>即可制作tab导航。<br>具体代码如下<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">ion-tabs</span> <span class="attr">class</span>=<span class="string">"tabs-icon-top tabs-color-active-balanced"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"首页"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-home positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-home-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.home"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-home"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"番茄钟"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-clock positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-clock-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.school"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-school"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"消息"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-chatbubble positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-chatbubble-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.message"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-message"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- &lt;ion-tab title="我的" icon-on="ion-ios-person positive" icon-off="ion-ios-person-outline"&gt;</span></span><br><span class="line"><span class="comment">        &lt;ion-nav-view animation="slide-left-right" name="tab-me"&gt;&lt;/ion-nav-view&gt;</span></span><br><span class="line"><span class="comment">    &lt;/ion-tab&gt; --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-tabs</span>&gt;</span></span><br></pre></td></tr></table></figure></ion-nav-view></ion-tab></ion-tabs></p>
<h3 id="关于ionic侧栏菜单"><a href="#关于ionic侧栏菜单" class="headerlink" title="关于ionic侧栏菜单"></a>关于ionic侧栏菜单</h3><p>利用ionic <ion-side-menu-content><ion-side-menu><ion-side-menus><br>具体代码如下:<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">ion-side-menus</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-side-menu-content</span> <span class="attr">drag-content</span>=<span class="string">"true"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-header-bar</span> <span class="attr">align-title</span>=<span class="string">"center"</span> <span class="attr">class</span>=<span class="string">"bar-stable bar-calm"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"buttons"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button no-animation button-icon icon ion-ios-list-outline"</span> <span class="attr">ng-click</span>=<span class="string">"toggleLeft()"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"wodivh1 title"</span>&gt;</span>EffectWork<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"buttons"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"button no-animation button-icon icon ion-ios-plus-outline"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-header-bar</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">ion-tabs</span> <span class="attr">class</span>=<span class="string">"tabs-icon-top tabs-color-active-balanced"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"首页"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-home positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-home-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.home"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-home"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"番茄钟"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-clock positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-clock-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.school"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-school"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">"消息"</span> <span class="attr">icon-on</span>=<span class="string">"ion-ios-chatbubble positive"</span> <span class="attr">icon-off</span>=<span class="string">"ion-ios-chatbubble-outline"</span> <span class="attr">ui-sref</span>=<span class="string">"tab.message"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">ion-nav-view</span> <span class="attr">animation</span>=<span class="string">"slide-left-right"</span> <span class="attr">name</span>=<span class="string">"tab-message"</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- &lt;ion-tab title="我的" icon-on="ion-ios-person positive" icon-off="ion-ios-person-outline"&gt;</span></span><br><span class="line"><span class="comment">        &lt;ion-nav-view animation="slide-left-right" name="tab-me"&gt;&lt;/ion-nav-view&gt;</span></span><br><span class="line"><span class="comment">    &lt;/ion-tab&gt; --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-tabs</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-side-menu-content</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-side-menu</span> <span class="attr">side</span>=<span class="string">"left"</span> <span class="attr">width</span>=<span class="string">"280"</span> <span class="attr">style</span>=<span class="string">"background-color:#4a87ee;"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">ion-content</span> <span class="attr">class</span>=<span class="string">"rj-stable-content"</span> <span class="attr">delegate-handle</span>=<span class="string">"sideScroll"</span> <span class="attr">id</span>=<span class="string">"userRegister"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">img</span> <span class="attr">class</span>=<span class="string">"radioImg"</span> <span class="attr">src</span>=<span class="string">"img/effectwork.jpeg"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"row"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col col-33 col-top"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col col-33 col-center word"</span>&gt;</span>&#123;&#123;name&#125;&#125;<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col col-33 col-bottom"</span>&gt;</span><span class="tag">&lt;<span class="name">span</span> <span class="attr">class</span>=<span class="string">"badge badge-calm"</span>&gt;</span>签到<span class="tag">&lt;/<span class="name">span</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col"</span>&gt;</span><span class="tag">&lt;<span class="name">br</span>&gt;</span><span class="tag">&lt;<span class="name">br</span>&gt;</span><span class="tag">&lt;<span class="name">br</span>&gt;</span><span class="tag">&lt;/<span class="name">br</span>&gt;</span><span class="tag">&lt;/<span class="name">br</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">br</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"row"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col word"</span>&gt;</span>金币:&#123;&#123;money&#125;&#125;<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"row"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"col word"</span>&gt;</span>签名:时间一直在这里，流逝的是我们自己。<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"list"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"item button icon-left ion-ios-cog-outline button-calm button-block"</span>&gt;</span>我的资料<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"item button icon-left ion-ios-browsers-outline button-calm button-block"</span>&gt;</span>任务箱<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"item button icon-left ion-ios-filing-outline button-calm button-block"</span>&gt;</span>统计情况<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">button</span> <span class="attr">class</span>=<span class="string">"item button icon-left ion-ios-paper-outline button-calm button-block"</span>&gt;</span>设置<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-content</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">ion-side-menu</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">ion-side-menus</span>&gt;</span></span><br></pre></td></tr></table></figure></ion-side-menus></ion-side-menu></ion-side-menu-content></p>
<h3 id="关于angularjs控制器传递数据"><a href="#关于angularjs控制器传递数据" class="headerlink" title="关于angularjs控制器传递数据"></a>关于angularjs控制器传递数据</h3><p>这个我现在不是特别全面,我目前采用的是\$rootScope和angularjs服务依赖注入传递数据，为什么用这两种，第一是\$rootScope的作用域，第二是服务在整个应用中的生命周期。肯定还有其他方法，可以去尝试。还有一种方法是通过$state传递参数，但是我屡试不爽。这个没做成功。</p>
<h3 id="关于cordova插件制作"><a href="#关于cordova插件制作" class="headerlink" title="关于cordova插件制作"></a>关于cordova插件制作</h3><p>我说这个是因为我觉得光用别人的插件，有好多限制啊，所以我想自己做。但是这个要做的话，要对Android，ios，windowsIphone开发要了解一点。<br>1、先说一下搭建cordova插件开发的环境吧<br>nodejs肯定是要安装的<br>然后全局安装cordova<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g cordova</span><br></pre></td></tr></table></figure></p>
<p>另外Android sdk肯定是要安装的，因为我们就是针对Android的sdk进行第三方开发。<br>如果都安装好了，让我们开始吧！<br>2、创建第一个应用<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cordova create hello com.cool.hello HelloWorld</span><br></pre></td></tr></table></figure></p>
<p>又是helloworld，你好世界！<br>让我来解释一下参数吧<br>第一个参数hello表示在工程目录中创建一个 hello 的文件夹<br>第二个参数com.cool.hello表示包名（反向域名），用于标志不同的 app<br>第三个参数HelloWorld表示项目的名称，可以在 config.xml 文件中修改<br>3、添加平台<br>进入创建的项目目录<br>查看已有的凭条<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cordova platforms list</span><br></pre></td></tr></table></figure></p>
<p>添加所需要的平台<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cordova platform add android</span><br></pre></td></tr></table></figure></p>
<p>如果想移除已经添加的平台的话cordova platform remove android 或者cordova platform rm android<br>4、编译项目<br>编译项目命令<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cordova build android</span><br></pre></td></tr></table></figure></p>
<p>5、运行项目<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cordova run android</span><br></pre></td></tr></table></figure></p>
<p>6、前面都是测试，我们这才开始插件开发<br>安装pluman<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install -g plugman</span><br></pre></td></tr></table></figure></p>
<p>plugman安装完之后就可以创建一个插件了<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cordova plugin plugman create --name --plugin_id --plugin_version [--path] [--variableName=VALUE]</span><br></pre></td></tr></table></figure></p>
<p>解释参数：<br>pluginName: 插件名字<br>pluginID: 插件id, egg:coolPlugin<br>oversion: 版本, egg : 0.0.1<br>directory:一个绝对或相对路径的目录，该目录将创建插件项目<br>variable NAME=VALUE: 额外的描述，如作者信息和相关描述<br>生成插件的目录<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">ExtraInfo</span><br><span class="line">├── src</span><br><span class="line">|    ├── android</span><br><span class="line">|    |    └── ExtraInfo.java</span><br><span class="line">|    ├── ios</span><br><span class="line">|    └── ...</span><br><span class="line">├── www</span><br><span class="line">|    └── ExtraInfo.js</span><br><span class="line">└── plugin.xml</span><br></pre></td></tr></table></figure></p>
<p>这里的 src 对应不同的平台，www 放我们的 javascript 文件，plugin.xml 是插件的配置文件。<br>接下来就说配置文件plugin.xml<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">plugin</span> <span class="attr">id</span>=<span class="string">"cn.net.wenzhixin.cordova"</span> <span class="attr">version</span>=<span class="string">"0.0.1"</span> </span></span><br><span class="line"><span class="tag">        <span class="attr">xmlns</span>=<span class="string">"http://apache.org/cordova/ns/plugins/1.0"</span></span></span><br><span class="line"><span class="tag">        <span class="attr">xmlns:android</span>=<span class="string">"http://schemas.android.com/apk/res/android"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">name</span>&gt;</span>ExtraInfo<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">description</span>&gt;</span>Description<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">js-module</span> <span class="attr">name</span>=<span class="string">"ExtraInfo"</span> <span class="attr">src</span>=<span class="string">"www/ExtraInfo.js"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">clobbers</span> <span class="attr">target</span>=<span class="string">"cordova.plugins.ExtraInfo"</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">js-module</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">platform</span> <span class="attr">name</span>=<span class="string">"android"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">config-file</span> <span class="attr">parent</span>=<span class="string">"/*"</span> <span class="attr">target</span>=<span class="string">"res/xml/config.xml"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">feature</span> <span class="attr">name</span>=<span class="string">"ExtraInfo"</span>&gt;</span></span><br><span class="line">                <span class="tag">&lt;<span class="name">param</span> <span class="attr">name</span>=<span class="string">"android-package"</span> <span class="attr">value</span>=<span class="string">"cn.net.wenzhixin.cordova.ExtraInfo"</span>/&gt;</span></span><br><span class="line">            <span class="tag">&lt;/<span class="name">feature</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">config-file</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">source-file</span> <span class="attr">src</span>=<span class="string">"src/android/ExtraInfo.java"</span> <span class="attr">target-dir</span>=<span class="string">"src/cn/net/wenzhixin/cordova"</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">platform</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">plugin</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>有几个关键的字段需要解释下：</p>
<ul>
<li>id: 插件的标识，即发布到 plugins.cordova.io 的 ID</li>
<li>name：插件的名称</li>
<li>description：描述信息</li>
<li>js-module：对应我们的 javascript 文件，src 属性指向 www/ExtraInfo.js</li>
<li>platform：支持的平台，这里仅仅用到了 android<br>下面这句<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">js-module</span> <span class="attr">src</span>=<span class="string">"www/barcodescanner.js"</span> <span class="attr">name</span>=<span class="string">"BarcodeScanner"</span>&gt;</span>  </span><br><span class="line">      <span class="tag">&lt;<span class="name">clobbers</span> <span class="attr">target</span>=<span class="string">"cordova.plugins.barcodeScanner"</span> /&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">js-module</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>这里很重要， 它指明了 插件的原始  js 文件放在哪里，clobbers target有用。等会用到，这会我们把它叫做 clobbers<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">config-file</span> <span class="attr">parent</span>=<span class="string">"/*"</span> <span class="attr">target</span>=<span class="string">"res/xml/config.xml"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">feature</span> <span class="attr">name</span>=<span class="string">"ExtraInfo"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">param</span> <span class="attr">name</span>=<span class="string">"android-package"</span> <span class="attr">value</span>=<span class="string">"cn.net.wenzhixin.cordova.ExtraInfo"</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">feature</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">config-file</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">source-file</span> <span class="attr">src</span>=<span class="string">"src/android/ExtraInfo.java"</span> <span class="attr">target-dir</span>=<span class="string">"src/cn/net/wenzhixin/cordova"</span>/&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>这里是插件的配置信息，最后会添加到 res/xml/config.xml 文件中，并且将我们的 src/android/ExtraInfo.java，复制到 android 的 package 包中。<br>feature name=”BarcodeScanner”  表示服务名为BarcodeScanner 。 记住这个服务名，有用.<br>value=”HXBarcodeScanner”       对应的.m文件中插件的类名  </p>
<p>helloPlugin.js配置<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> exec = <span class="built_in">require</span>(<span class="string">'cordova/exec'</span>);</span><br><span class="line"><span class="keyword">var</span> myFunc = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;&#125;;</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line"><span class="comment">// arg1：成功回调</span></span><br><span class="line"><span class="comment">// arg2：失败回调</span></span><br><span class="line"><span class="comment">// arg3：将要调用类配置的标识</span></span><br><span class="line"><span class="comment">// arg4：调用的原生方法名</span></span><br><span class="line"><span class="comment">// arg5：参数，json格式</span></span><br><span class="line">myFunc.prototype.showToast=<span class="function"><span class="keyword">function</span>(<span class="params">success, error</span>) </span>&#123;</span><br><span class="line">    exec(success, error, <span class="string">"CoolToast"</span>, <span class="string">"showToast"</span>, []);</span><br><span class="line">&#125;;</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">myFunc.prototype.showshowToast=<span class="function"><span class="keyword">function</span>(<span class="params">text, lenth,success, error</span>) </span>&#123;</span><br><span class="line">    exec(success, error, <span class="string">"CoolToast"</span>, <span class="string">"showshowToast"</span>, [text, lenth]);</span><br><span class="line">&#125;;</span><br><span class="line">myFunc.prototype.openActivity=<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    exec(<span class="literal">null</span>, <span class="literal">null</span>, <span class="string">"CoolToast"</span>, <span class="string">"openActivity"</span>, []);</span><br><span class="line">&#125;;</span><br><span class="line"><span class="keyword">var</span> showt = <span class="keyword">new</span> myFunc();</span><br><span class="line"><span class="built_in">module</span>.exports = showt;</span><br></pre></td></tr></table></figure></p>
<p>最后还有一个java类<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.cool.toast;</span><br><span class="line"> </span><br><span class="line"><span class="keyword">import</span> org.apache.cordova.CallbackContext;</span><br><span class="line"><span class="keyword">import</span> org.apache.cordova.CordovaPlugin;</span><br><span class="line"><span class="keyword">import</span> org.json.JSONArray;</span><br><span class="line"><span class="keyword">import</span> org.json.JSONException;</span><br><span class="line"><span class="keyword">import</span> com.example.hello.TestActivity;</span><br><span class="line"><span class="keyword">import</span> android.content.Intent;</span><br><span class="line"><span class="keyword">import</span> android.widget.Toast;</span><br><span class="line"> </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ShowToast</span> <span class="keyword">extends</span> <span class="title">CordovaPlugin</span> </span>&#123;</span><br><span class="line"> </span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">execute</span><span class="params">(String action, JSONArray args, CallbackContext callbackContext)</span> <span class="keyword">throws</span> JSONException </span>&#123;</span><br><span class="line"><span class="comment">// TODO Auto-generated method stub</span></span><br><span class="line"><span class="keyword">if</span>(<span class="string">"showToast"</span>.equals(action))&#123;</span><br><span class="line">Toast.makeText(cordova.getActivity(), <span class="string">"show..."</span>, Toast.LENGTH_SHORT).show();</span><br><span class="line">callbackContext.success(<span class="string">"success"</span>);</span><br><span class="line"><span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(<span class="string">"showshowToast"</span>.equals(action))&#123;</span><br><span class="line">String str = args.getString(<span class="number">0</span>);</span><br><span class="line"><span class="keyword">int</span> len = args.getInt(<span class="number">1</span>);</span><br><span class="line"> </span><br><span class="line"><span class="keyword">if</span>(len == <span class="number">0</span>)&#123;</span><br><span class="line">Toast.makeText(cordova.getActivity(), str, Toast.LENGTH_SHORT).show();</span><br><span class="line">callbackContext.success(<span class="string">"success"</span> + str);</span><br><span class="line"><span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">&#125;<span class="keyword">else</span>&#123;</span><br><span class="line">Toast.makeText(cordova.getActivity(), str, Toast.LENGTH_LONG).show();</span><br><span class="line">callbackContext.success(<span class="string">"success"</span> + str);</span><br><span class="line"><span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">&#125;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(<span class="string">"openActivity"</span>.equals(action))&#123;</span><br><span class="line">openActivity();</span><br><span class="line">callbackContext.success(<span class="string">"success"</span>);</span><br><span class="line"><span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">&#125;</span><br><span class="line"> callbackContext.error(<span class="string">"error"</span>);</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">false</span>; </span><br><span class="line">&#125;</span><br><span class="line"> </span><br><span class="line"><span class="function"><span class="keyword">private</span> <span class="keyword">void</span> <span class="title">openActivity</span><span class="params">()</span> </span>&#123;</span><br><span class="line">Intent intent = <span class="keyword">new</span> Intent(cordova.getActivity(),TestActivity.class);</span><br><span class="line">cordova.getActivity().startActivity(intent);</span><br><span class="line">&#125;</span><br><span class="line"> </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>继承了 CordovaPlugin 类，并重写 execute 方法，使用 action 来判断我们在 javascript 中调用的方法名，成功的话调用 callbackContext.success(message)，失败调用 callbackContext.error(message) 方法，分别对应 javascript 文件中的 success 和 error 回调函数。<br>当然，这里只用到 android 平台，其他的平台也是一样的，ios 使用 object-c、wp7 使用 c# 语言，例子见Plugin Development Guide。<br>7、插件安装<br>我的插件所在的路径是F:\CoolPlugin</p>
<p>首先切换到最初创建的hello目录 cd hello</p>
<p>执行插件安装命令cordova plugin addF:\CoolPlugin</p>
<p>执行完之后你就发现插件已经安装上去了<br>8、插件的使用<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">cool.toast.showToast();</span><br><span class="line">  cool.toast.showshowToast(<span class="string">"hello"</span>,<span class="number">0</span>, <span class="function"><span class="keyword">function</span>(<span class="params">msg</span>) </span>&#123;</span><br><span class="line">                alert(msg);</span><br><span class="line">            &#125;, <span class="function"><span class="keyword">function</span>(<span class="params">msg</span>) </span>&#123;</span><br><span class="line">                alert(msg);</span><br><span class="line">            &#125;);</span><br><span class="line"> </span><br><span class="line">cool.toast.openActivity();</span><br></pre></td></tr></table></figure></p>
<p>这样就可以成功调用了。<br>7、最后还是说说这个插件开发<br>我认为就分两个<br>一个是JavaScript interface<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">cordova.exec(<span class="function"><span class="keyword">function</span>(<span class="params">winParam</span>) </span>&#123;&#125;,  </span><br><span class="line">                 <span class="function"><span class="keyword">function</span>(<span class="params">error</span>) </span>&#123;&#125;,  </span><br><span class="line">                 <span class="string">"service"</span>,  </span><br><span class="line">                 <span class="string">"action"</span>,  </span><br><span class="line">                 [<span class="string">"firstArgument"</span>, <span class="string">"secondArgument"</span>, <span class="number">42</span>, <span class="literal">false</span>]);</span><br></pre></td></tr></table></figure></p>
<p>参数意义：1.成功的回调函数<br>         2.失败的回调函数<br>         3.native端的名称<br>         4.native端的action名称<br>         5.参数<br>这是翻译的，看一下原文</p>
<ul>
<li>function(winParam) {}: A success callback function. Assuming yourexec call completes successfully, this function executes alongwith any parameters you pass to it.</li>
<li>function(error) {}: An error callback function. If the operationdoes not complete successfully, this function executes with anoptional error parameter.</li>
<li>“service”: The service name to call on the native side. Thiscorresponds to a native class, for which more information isavailable in the native guides listed below.</li>
<li>“action”: The action name to call on the native side. Thisgenerally corresponds to the native class method. See the nativeguides listed below.</li>
<li>[/<em> arguments </em>/]: An array of arguments to pass into the nativeenvironment.<br>官方示例:<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">window</span>.echo = <span class="function"><span class="keyword">function</span>(<span class="params">str, callback</span>) </span>&#123;  </span><br><span class="line">        cordova.exec(callback, <span class="function"><span class="keyword">function</span>(<span class="params">err</span>) </span>&#123;  </span><br><span class="line">            callback(<span class="string">'Nothing to echo.'</span>);  </span><br><span class="line">        &#125;, <span class="string">"Echo"</span>, <span class="string">"echo"</span>, [str]);  </span><br><span class="line">    &#125;;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">window</span>.echo(<span class="string">"echome"</span>, <span class="function"><span class="keyword">function</span>(<span class="params">echoValue</span>) </span>&#123;  </span><br><span class="line">        alert(echoValue == <span class="string">"echome"</span>); <span class="comment">// should alert true.  </span></span><br><span class="line">    &#125;);</span><br></pre></td></tr></table></figure>
<p>第二个就是native interface<br>上面说的都是Android的这里说IOS吧<br>首先，是config.xml文件中需要配置<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">platform</span> <span class="attr">name</span>=<span class="string">"ios"</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">config-file</span> <span class="attr">target</span>=<span class="string">"config.xml"</span> <span class="attr">parent</span>=<span class="string">"/*"</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">feature</span> <span class="attr">name</span>=<span class="string">"Echo"</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">param</span> <span class="attr">name</span>=<span class="string">"ios-package"</span> <span class="attr">value</span>=<span class="string">"Echo"</span> /&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">feature</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">config-file</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">platform</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>注意点：1.feature name要与exec中的service对应<br>       2.param value要与exec中的action对应<br>       3.param name要写成ios-package<br>其次，object-c的class要继承CDVPlugin<br>官方示例:<br><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/********* Echo.h Cordova Plugin Header *******/</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">#import <span class="meta-string">&lt;Cordova/CDV.h&gt;  </span></span></span><br><span class="line">  </span><br><span class="line">    @interface Echo : CDVPlugin  </span><br><span class="line">  </span><br><span class="line">    - (<span class="keyword">void</span>)echo:(CDVInvokedUrlCommand*)command;  </span><br><span class="line">  </span><br><span class="line">    @end  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/********* Echo.m Cordova Plugin Implementation *******/</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">#import <span class="meta-string">"Echo.h"</span>  </span></span><br><span class="line">    <span class="meta">#import <span class="meta-string">&lt;Cordova/CDV.h&gt;  </span></span></span><br><span class="line">  </span><br><span class="line">    @implementation Echo  </span><br><span class="line">  </span><br><span class="line">    - (<span class="keyword">void</span>)echo:(CDVInvokedUrlCommand*)command  </span><br><span class="line">    &#123;  </span><br><span class="line">        CDVPluginResult* pluginResult = nil;  </span><br><span class="line">        <span class="comment">//获取exec中传过来的参数  </span></span><br><span class="line">        NSString* echo = [command.arguments objectAtIndex:<span class="number">0</span>];  </span><br><span class="line">  </span><br><span class="line">        <span class="keyword">if</span> (echo != nil &amp;&amp; [echo length] &gt; <span class="number">0</span>) &#123;  </span><br><span class="line">            <span class="comment">//返回成功，messageAsString将数据返回到JavaScript。  </span></span><br><span class="line">            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];  </span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">            <span class="comment">//返回失败。  </span></span><br><span class="line">            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];  </span><br><span class="line">        &#125;  </span><br><span class="line">        <span class="comment">//将结果发送给&lt;code&gt;self.commandDelegate&lt;/code&gt;，这样会执行JavaScript side的成功或失败方法。  </span></span><br><span class="line">        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];  </span><br><span class="line">   &#125; @end</span><br></pre></td></tr></table></figure></p>
<p>这就是cordova插件开发。</p>
<h3 id="关于tabs无法置底的问题"><a href="#关于tabs无法置底的问题" class="headerlink" title="关于tabs无法置底的问题"></a>关于tabs无法置底的问题</h3><p>在应用的.config<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ionicConfigProvider.platform.ios.tabs.style(<span class="string">'standard'</span>); </span><br><span class="line">   $ionicConfigProvider.platform.ios.tabs.position(<span class="string">'bottom'</span>);</span><br><span class="line">   $ionicConfigProvider.platform.android.tabs.style(<span class="string">'standard'</span>);</span><br><span class="line">   $ionicConfigProvider.platform.android.tabs.position(<span class="string">'standard'</span>);</span><br></pre></td></tr></table></figure></p>
<h3 id="关于ionic退回按钮"><a href="#关于ionic退回按钮" class="headerlink" title="关于ionic退回按钮"></a>关于ionic退回按钮</h3><p>代码如下:<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">$ionicPlatform.registerBackButtonAction(<span class="function"><span class="keyword">function</span> (<span class="params">e</span>) </span>&#123;</span><br><span class="line">            <span class="comment">//判断处于哪个页面时双击退出</span></span><br><span class="line">            <span class="keyword">if</span> ($location.path() == <span class="string">'/tab/home'</span>) &#123;</span><br><span class="line">                <span class="keyword">if</span> ($rootScope.backButtonPressedOnceToExit) &#123;</span><br><span class="line">                    ionic.Platform.exitApp();</span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                    $rootScope.backButtonPressedOnceToExit = <span class="literal">true</span>;</span><br><span class="line">                    $cordovaToast.showLongBottom(<span class="string">'再按一次退出系统'</span>);</span><br><span class="line">                    setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                        $rootScope.backButtonPressedOnceToExit = <span class="literal">false</span>;</span><br><span class="line">                    &#125;, <span class="number">2000</span>);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span> <span class="keyword">if</span> ($ionicHistory.backView()) &#123;</span><br><span class="line">                $ionicHistory.goBack();</span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">              <span class="keyword">if</span> ($rootScope.backButtonPressedOnceToExit) &#123;</span><br><span class="line">                    ionic.Platform.exitApp();</span><br><span class="line">                &#125; <span class="keyword">else</span>&#123;</span><br><span class="line">                $rootScope.backButtonPressedOnceToExit = <span class="literal">true</span>;</span><br><span class="line">                $cordovaToast.showLongBottom(<span class="string">'再按一次退出系统'</span>);</span><br><span class="line">                setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">                    $rootScope.backButtonPressedOnceToExit = <span class="literal">false</span>;</span><br><span class="line">                &#125;, <span class="number">2000</span>);</span><br><span class="line">                &#125;</span><br><span class="line">              &#125;</span><br><span class="line">            e.preventDefault();</span><br><span class="line">            <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">        &#125;, <span class="number">101</span>);</span><br></pre></td></tr></table></figure></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/总结/" rel="tag"># 总结</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/12/26/fourth/" rel="next" title="谈一谈内存和栈">
                <i class="fa fa-chevron-left"></i> 谈一谈内存和栈
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/12/26/third/" rel="prev" title="asp.net异步请求">
                asp.net异步请求 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
  <a class="jiathis_button_tsina"></a>
  <a class="jiathis_button_tqq"></a>
  <a class="jiathis_button_weixin"></a>
  <a class="jiathis_button_cqq"></a>
  <a class="jiathis_button_douban"></a>
  <a class="jiathis_button_renren"></a>
  <a class="jiathis_button_qzone"></a>
  <a class="jiathis_button_kaixin001"></a>
  <a class="jiathis_button_copy"></a>
  <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank"></a>
  <a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">
  var jiathis_config={
    hideMore:false
  }
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END -->

      
    </div>
  </div>


          </div>
          

  <p>热评文章</p>
  <div class="ds-top-threads" data-range="weekly" data-num-items="4"></div>


          
  <div class="comments" id="comments">
    
      <div id="hypercomments_widget"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image" src="/uploads/avatar.jpg" alt="腊月的季节">
          <p class="site-author-name" itemprop="name">腊月的季节</p>
          <p class="site-description motion-element" itemprop="description">腊月的季节的个人博客</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">160</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">72</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              我的其他足迹
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://blog.csdn.net/qq_33433029" title="CSDN博客" target="_blank">CSDN博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://github.com/youandme66" title="GitHub" target="_blank">GitHub</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.jianshu.com/users/767025e0c4df/timeline" title="我的简书" target="_blank">我的简书</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://www.zhihu.com/people/liu-zhi-hao-85-39/activities" title="我的知乎" target="_blank">我的知乎</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#探索ionic轮播"><span class="nav-number">1.</span> <span class="nav-text">探索ionic轮播</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#探索ionic视图设定"><span class="nav-number">2.</span> <span class="nav-text">探索ionic视图设定</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#路由跳转"><span class="nav-number">3.</span> <span class="nav-text">路由跳转</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于键盘窗口挡住输入框"><span class="nav-number">4.</span> <span class="nav-text">关于键盘窗口挡住输入框</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于ionic上拉菜单样式问题"><span class="nav-number">5.</span> <span class="nav-text">关于ionic上拉菜单样式问题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于标签"><span class="nav-number">6.</span> <span class="nav-text">关于标签</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于ionic侧栏菜单"><span class="nav-number">7.</span> <span class="nav-text">关于ionic侧栏菜单</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于angularjs控制器传递数据"><span class="nav-number">8.</span> <span class="nav-text">关于angularjs控制器传递数据</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于cordova插件制作"><span class="nav-number">9.</span> <span class="nav-text">关于cordova插件制作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于tabs无法置底的问题"><span class="nav-number">10.</span> <span class="nav-text">关于tabs无法置底的问题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于ionic退回按钮"><span class="nav-number">11.</span> <span class="nav-text">关于ionic退回按钮</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">
  
  &copy;  2016 - 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">腊月的季节</span>
</div>


<div class="powered-by">
   <a class="theme-link" href="http://www.jianshu.com/users/767025e0c4df/timeline">我的简书</a> 
</div>

<div class="theme-info">
  链接 -
  <a class="theme-link" href="https://www.zhihu.com/people/liu-zhi-hao-85-39/activities">
    我的知乎
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>


  



  




	

		<script type="text/javascript">
		_hcwp = window._hcwp || [];

		_hcwp.push({widget:"Bloggerstream", widget_id: 93245, selector:".hc-comment-count", label: "{\%COUNT%\}" });

		
		_hcwp.push({widget:"Stream", widget_id: 93245, xid: "2016/12/26/second/"});
		

		(function() {
		if("HC_LOAD_INIT" in window)return;
		HC_LOAD_INIT = true;
		var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || "en").substr(0, 2).toLowerCase();
		var hcc = document.createElement("script"); hcc.type = "text/javascript"; hcc.async = true;
		hcc.src = ("https:" == document.location.protocol ? "https" : "http")+"://w.hypercomments.com/widget/hc/93245/"+lang+"/widget.js";
		var s = document.getElementsByTagName("script")[0];
		s.parentNode.insertBefore(hcc, s.nextSibling);
		})();
		</script>

	





  
  
  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body").append('<div class="popoverlay">').css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".popoverlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>


  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("EAvSG3QtXW1dqzq5WQ5CjH7S-gzGzoHsz", "2aiWv7vIfVY4CjKc49aPBHFX");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

</body>
</html>
